define [ 'fizz' ], (fizz) ->
  class extends fizz.Model
  
    urlRoot : 'rest/users',
    
    defaults :
      # Login
      login : '',
      # Display name
      displayname : ''
      # Password
      password : ''
      # Roles object
      roles : ''

    validate : (attrs) ->
      errors = [];
      unless attrs.login?.length
        errors.push 'user.validation.emptyLogin'
      unless attrs.displayname?.length
        errors.push 'user.validation.emptyDisplayname'
      if errors.length
        return errors
      null
    
    toString : () ->
      @get 'login'
